/*
 * @Author: daniel_du dll_2018@126.com
 * @Date: 2022-05-01 06:35:50
 * @LastEditors: daniel_du dll_2018@126.com
 * @LastEditTime: 2022-05-09 13:52:52
 * @FilePath: /safe_transmission_platform/src/util.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include "util.h"
#include <time.h>
#include <cstring>

namespace daniel
{
    uint32_t getThreadID()
    {
        return syscall(SYS_gettid);
    }
    std::string GetDatetime()
    {
        struct tm tm;
        time_t timeSeconds;
        time(&timeSeconds);
        localtime_r(&timeSeconds, &tm);
        char buf[64];
        strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm);
        return std::string(buf);
    }
} // namespace daniel
